package spikes.md5;

import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Test {
	public static void main(String[] args) throws UnsupportedEncodingException, NoSuchAlgorithmException {
		String yourString = "!!Dd7zqcsn";
		byte[] bytesOfMessage = yourString.getBytes("UTF-8");

		MessageDigest md = MessageDigest.getInstance("MD5");
		byte[] thedigest = md.digest(bytesOfMessage);
		
		byte[] ny = new byte[17];
		for (int i = 0; i < 16; i++) {
			ny[i+1] = thedigest[i];
		}
		String generated = new BigInteger(ny).toString(16);
		
		
		String text = "b0d0114da37ea9d8650996dd6aa6910e";
		
		System.out.println(text.equals(generated));
	}
}
